package online.duanqing.mqspringboot.controller;

import online.duanqing.mqspringboot.bean.User;
import online.duanqing.mqspringboot.service.MQProducerService;
import org.apache.rocketmq.client.producer.SendResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with FR
 *
 * @Author: DQ
 * @Date: 2024/10/18/10:06
 * @Description: 描述语句
 */
@RestController
@RequestMapping("/rocketmq")
public class RocketMQController {

    @Autowired
    private MQProducerService mqProducerService;

        @GetMapping("/send")
    public void send() {
        User user = new User();
        mqProducerService.send(user);
    }

    @GetMapping("/sendTag")
    public SendResult sendTag() {
        SendResult sendResult = mqProducerService.sendTagMsg("带有tag的字符消息");
        return sendResult;
    }

}

